package com.project.controller;

import com.project.bean.UserBean;
import com.project.util.UploadUtil;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("upload")
public class UploadController {

    @RequestMapping("add")
    public UserBean add(UserBean user, @RequestParam("face") MultipartFile mf) throws Exception {
        String fileName =  UploadUtil.upload(mf,"static/html/img");
        user.setImgPath(fileName);
        return user;
    }
}
